<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/extend/autocomplete.css?v={{ layui.setter.version }}"
          media="all">
</script>
<div zm-load="/head.html" class="no-effect print-hide"></div>
<div class="page-width layui-row layout-body" id="manage_body">
    <div class="layui-side print-hide">
        <div class="layui-side-scroll">
            <div class="set-width">
                <a href="javascript:" lay-href="index">
                    <div class="user-idx">
                        <div class="info-tag">
                            <div class="left"></div>
                            个人首页
                            <div class="right"></div>
                        </div>
                        <div class="avatar">
                            <img id="layout-user-head" src="/img/default.jpg">
                        </div>
                        <div class="tac" style="margin-top: -20px;">
                            <span class="u-name" id="layout-user-name"></span>
                        </div>
                    </div>
                </a>
                <div class="zm-bg-black">
                    <script type="text/html" template lay-url="/json/menu.js?v={{ layui.setter.version }}" lay-done="layui.element.render('nav', 'layadmin-system-side-menu');" id="TPL_layout">
                        <ul class="layui-nav layui-nav-tree layui-inline" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                            {{#
                            var path =  layui.router().path
                            ,pathURL = layui.admin.correctRouter(path.join('/'))
                            ,dataName = layui.setter.response.dataName;

                            layui.each(d[dataName], function(index, item){
                            var hasChildren = typeof item.list === 'object' && item.list.length > 0

                            ,url = (item.jump && typeof item.jump === 'string') ? item.jump : item.name;
                            }}
                            <li data-name="{{ item.name || '' }}" data-jump="{{ item.jump || '' }}" class="layui-nav-item layui-nav-itemed">
                                <a href="javascript:;" {{ hasChildren ? '' : 'lay-href="'+ url +'"' }} lay-tips="{{ item.title }}" lay-direction="2">
                                <i class="layui-icon {{ item.icon }}"></i>
                                <cite>{{ item.title }}</cite>
                                </a>
                                {{# if(hasChildren){ }}
                                <dl class="layui-nav-child">
                                    {{# layui.each(item.list, function(index2, item2){
                                    var hasChildren2 = typeof item2.list == 'object' && item2.list.length > 0
                                    ,classSelected2 = function(){
                                    var match = (path[0] == item.name && path[1] == item2.name)  || (item2.jump && pathURL == layui.admin.correctRouter(item2.jump)) || item2.spread;
                                    if(match){
                                    return hasChildren2 ? 'layui-nav-itemed' : 'layui-this';
                                    }
                                    return '';
                                    }
                                    ,url2 = (item2.jump && typeof item2.jump === 'string')
                                    ? item2.jump
                                    : [item.name, item2.name, ''].join('/');
                                    }}
                                    <dd data-name="{{ item2.name || '' }}" data-jump="{{ item2.jump || '' }}"
                                         {{ classSelected2() ? ('class="'+ classSelected2() +'"') : '' }}>
                                    <a href="javascript:;" {{ hasChildren2 ? '' : 'lay-href="'+ url2 +'"' }}>{{ item2.title }}</a>
                                    {{# if(hasChildren2){ }}
                                    <dl class="layui-nav-child">
                                        {{# layui.each(item2.list, function(index3, item3){
                                        var match = (path[0] == item.name && path[1] == item2.name && path[2] == item3.name)
                                        || (item3.jump && pathURL == layui.admin.correctRouter(item3.jump))
                                        ,url3 = (item3.jump && typeof item3.jump === 'string')
                                        ? item3.jump
                                        : [item.name, item2.name, item3.name].join('/')
                                        }}
                                        <dd data-name="{{ item3.name || '' }}"  data-jump="{{ item3.jump || '' }}"
                                            {{ match ? 'class="layui-this"' : '' }}>
                                        <a href="javascript:;" lay-href="{{ url3 }}" {{ item3.iframe ? 'lay-iframe="true"' : '' }}>{{ item3.title }}</a>
                                        </dd>
                                        {{# }); }}
                                    </dl>
                                    {{# } }}
                                    </dd>
                                    {{# }); }}
                                </dl>
                                {{# } }}
                            </li>
                            {{# }); }}
                        </ul>
                    </script>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-body">
        <div class="child-box-scroll" id="app_body"></div>
    </div>
</div>


<script>
    layui.define(function () {
        var $ = layui.jquery, com = layui.com, $manageBody = $('#manage_body'), layout = function () {
            $manageBody.css({'height': $(window).height() - $manageBody.position().top})
        };
        layout();
        $(window).resize(function () {
            layout();
        });
        let userInfo = com.getUser();
        if(userInfo && userInfo.loginInfo){
            $('#layout-user-name').text(userInfo.loginInfo.personName);
            if(com.isNotEmpty(userInfo.loginInfo.userHead)){
                $("#layout-user-head").attr('src',userInfo.loginInfo.userHead);
            }
        }
    });
</script>